import 'dart:async';

import 'dart:io';

import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'package:sqflite/sqflite.dart';

Future<String> initCreateDb(String dbName) async {
  Directory documentDirectory = await getApplicationDocumentsDirectory();
  print(documentDirectory);

  String path = join(documentDirectory.path,dbName);

  if(await new Directory(dirname(path)).exists()){
    print("已经存在数据库了");
  }else{
    try{
      await new Directory(dirname(path)).create(recursive: true);

    }catch(e){
      print(e);
    }
  }

  return path;
}